﻿/*----------------------------------------------------------------
 * 
 * 版权所有：Copyright (C) 2013
 * 
 * 文件名：IManagerProduct.cs
 * 文件功能描述：
 * 
 * 
 * 作 者：zhangq
 * 邮 箱：ifunnyface@outlook.com
 * 日 期：2013-01-07 15:05:40
 * 
 * 
 * 修改标识： Author
 * 修改描述： 相关描述
 * 
 * ---------------------------------------------------------------- */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using Common.Extensions.OrderBy;
using DomainModel;

namespace IManager
{

    /// <summary>
    /// 
    /// </summary>
    public interface IManagerProduct
    {

        #region 产品分类

        /// <summary>
        /// 通过Id获取分类
        /// </summary>
        /// <param name="partitionId">Id</param>
        /// <returns>分类信息</returns>
        ProductPartitionInfo GetPartition(string partitionId);


        /// <summary>
        /// 获取最大编号
        /// </summary>
        /// <param name="prefix">前缀</param>
        /// <returns>编号</returns>
        string Max(string prefix);


        /// <summary>
        /// 获取分类
        /// </summary>
        /// <returns>分类列表</returns>
        IList<ProductPartitionInfo> GetPartitions();


        /// <summary>
        /// 添加分类信息
        /// </summary>
        /// <param name="partitionInfo">分类信息</param>
        /// <returns>True=操作成功/False=操作失败</returns>
        bool AddPartition(ProductPartitionInfo partitionInfo);


        /// <summary>
        /// 删除分类信息
        /// </summary>
        /// <param name="partitionId">Id</param>
        /// <returns>True=操作成功/False=操作失败</returns>
        bool DeletePartition(string partitionId);


        /// <summary>
        /// 删除分类信息
        /// </summary>
        /// <param name="partitionIds">Id</param>
        /// <returns>True=操作成功/False=操作失败</returns>
        bool DeletePartition(IList<string> partitionIds);


        /// <summary>
        /// 更新分类信息
        /// </summary>
        /// <param name="partitionInfo">分类信息</param>
        /// <returns>True=操作成功/False=操作失败</returns>
        bool UpdatePartition(ProductPartitionInfo partitionInfo);


        /// <summary>
        /// 根据条件分页获得记录
        /// </summary>
        /// <param name="where">条件</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="pageSize">每页大小</param>
        /// <param name="orderByExpressions">排序字段</param>
        /// <returns>记录列表</returns>
        IList<ProductPartitionInfo> LoadAll(Expression<Func<ProductPartitionInfo, bool>> where,
                                                   int pageIndex,
                                                   int pageSize,
                                                   params IOrderByExpression<ProductPartitionInfo>[] orderByExpressions);


        /// <summary>
        /// 获取总数
        /// </summary>
        /// <param name="where">条件</param>
        /// <returns>记录总数</returns>
        int LoadCount(Expression<Func<ProductPartitionInfo, bool>> where);


        /// <summary>
        /// 根据条件分页获得记录
        /// </summary>
        /// <param name="where">条件</param>
        /// <param name="orderByExpressions">排序字段</param>
        /// <returns>记录列表</returns>
        IList<ProductPartitionInfo> LoadAll(Expression<Func<ProductPartitionInfo, bool>> where, params IOrderByExpression<ProductPartitionInfo>[] orderByExpressions);
        
        #endregion


        #region 产品


        /// <summary>
        /// 添加产品
        /// </summary>
        /// <param name="product">产品信息</param>
        /// <returns>bool</returns>
        bool AddProduct(ProductInfo product);



        /// <summary>
        /// 根据条件分页获得记录
        /// </summary>
        /// <param name="where">条件</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="pageSize">每页大小</param>
        /// <param name="orderByExpressions">排序字段</param>
        /// <returns>记录列表</returns>
        IList<ProductInfo> LoadProductAll(Expression<Func<ProductInfo, bool>> where,
                                                   int pageIndex,
                                                   int pageSize,
                                                   params IOrderByExpression<ProductInfo>[] orderByExpressions);


        /// <summary>
        /// 获取总数
        /// </summary>
        /// <param name="where">条件</param>
        /// <returns>记录总数</returns>
        int LoadProductCount(Expression<Func<ProductInfo, bool>> where);



        /// <summary>
        /// 通过Id获取分类
        /// </summary>
        /// <param name="Id">Id</param>
        /// <returns>分类信息</returns>
        ProductInfo GetProduct(int Id);



        /// <summary>
        /// 删除分类信息
        /// </summary>
        /// <param name="id">Id</param>
        /// <returns>True=操作成功/False=操作失败</returns>
        bool DeleteProduct(int id);


        /// <summary>
        /// 删除分类信息
        /// </summary>
        /// <param name="ids">Id</param>
        /// <returns>True=操作成功/False=操作失败</returns>
        bool DeleteProduct(IList<int> ids);


        /// <summary>
        /// 更新分类信息
        /// </summary>
        /// <param name="info">分类信息</param>
        /// <returns>True=操作成功/False=操作失败</returns>
        bool UpdateProduct(ProductInfo info);



        #endregion
    }

}